package com.example.simplemybatisspringboot.service;

import com.example.simplemybatisspringboot.dao.TestDao;
import com.example.simplemybatisspringboot.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestService {
    @Autowired
    TestDao testDao;

    /**
     * 通过名字查
     * @param name
     * @return
     */
    public Person getInfoByName(String name){
        return testDao.getInfoByName(name);
    }

    /**
     * 查所有person
     * @return
     */
    public List<Person> getInfos(){
        return testDao.getInfos();
    }

    /**
     * 添加person
     * @param person
     */
    public void addPerson(Person person){
        testDao.addPerson(person);
    }
}
